﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="admin_question.aspx.cs" Inherits="skvote.admin_question" %>

<%@ Import Namespace="System.Data.OleDb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<%skvote.function.header(Response);%>
<title>【单考投票系统】后台管理中心</title>
</head>
<body>
<table border="0" cellpadding="1" cellspacing="2" width="100%" id="table1" bgcolor="#E1F0FF">
 <form id="xhh" runat="server" method="post">
  <tr>
    <td>
	  <table width="100%" id="table2" cellspacing="1">
	     <tr>
          <td id="TableTitle1"> 管理投票答案-&gt;<%
          if (!string.IsNullOrEmpty(Request["tid"]) && !string.IsNullOrEmpty(Request["k"]))
            {
                string title = "";
                OleDbConnection conn = new skvote.conn().CreateConnection();
                try
                {
                    OleDbCommand cmd = new OleDbCommand("select * from xh_title where id=" + Request["tid"], conn);
                    OleDbDataReader dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        title = dr["title"].ToString().Trim();                             
                    }
                    dr.Close();
                    cmd.Dispose();                    
                }
                finally
                {
                    conn.Close();
                }
                Response.Write("所属标题(" + title + ")-&gt搜索答案(" + Request["k"] + ")");
            }
              
          else if (string.IsNullOrEmpty(Request["tid"]) && !string.IsNullOrEmpty(Request["k"]))
            {
                Response.Write("搜索答案(" + Request["k"]+")");
            }
          else if (!string.IsNullOrEmpty(Request["tid"]) && string.IsNullOrEmpty(Request["k"]))
            {
                string title = "";
                OleDbConnection conn = new skvote.conn().CreateConnection();
                try
                {
                    OleDbCommand cmd = new OleDbCommand("select * from xh_title where id=" + Request["tid"], conn);
                    OleDbDataReader dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        title = dr["title"].ToString().Trim();
                    }
                    dr.Close();
                    cmd.Dispose();
                }
                finally
                {
                    conn.Close();
                }
                Response.Write("所属标题(" + title + ")");                
            }
            else
            {
                Response.Write("所有问题");
            }%>
      	</td>
		 </tr>
	   </table>
	   </td>
  </tr>
  <tr>
    <td>      
      <asp:DataGrid ID="table2" runat="server" AllowPaging="true" 
            AutoGenerateColumns="False" BorderColor="#BFDFFF" BorderWidth="1px" 
            CellSpacing="1" ShowFooter="true" Width="100%" 
            onitemcreated="table2_ItemCreated" PageSize="20" 
            onpageindexchanged="table2_PageIndexChanged">
          <PagerStyle Mode="NumericPages" HorizontalAlign="Left" Visible="false" />
          <Columns>
          <asp:TemplateColumn FooterStyle-CssClass="DataGrid1_Header_Footer" HeaderStyle-CssClass="DataGrid1_Header_Footer">
          <HeaderStyle Width="5%" HorizontalAlign="Center" />
          <HeaderTemplate>ID</HeaderTemplate>
          <FooterStyle Width="5%" HorizontalAlign="Center" />
          <FooterTemplate>ID</FooterTemplate>
          <ItemStyle Width="5%" HorizontalAlign="Center" />
          <ItemTemplate>
          <%#DataBinder.Eval(Container.DataItem,"ID")%>
          </ItemTemplate>
          </asp:TemplateColumn>
          
          <asp:TemplateColumn FooterStyle-CssClass="DataGrid1_Header_Footer" HeaderStyle-CssClass="DataGrid1_Header_Footer">
          <HeaderStyle Width="5%" HorizontalAlign="Center" />
          <HeaderTemplate><asp:CheckBox ID="headerchk" runat="server" Text="" AutoPostBack="true" /></HeaderTemplate>
          <FooterStyle Width="5%" HorizontalAlign="Center" />
          <FooterTemplate><asp:CheckBox ID="footerchk" runat="server" Text="" AutoPostBack="true" /></FooterTemplate>
          <ItemStyle Width="5%" HorizontalAlign="Center" />
          <ItemTemplate>
          <asp:CheckBox ID="choosechk" runat="server" Text="" ToolTip='<%#DataBinder.Eval(Container.DataItem,"Id")%>' />
          </ItemTemplate>
          </asp:TemplateColumn>
          
          <asp:TemplateColumn FooterStyle-CssClass="DataGrid1_Header_Footer" HeaderStyle-CssClass="DataGrid1_Header_Footer">
          <HeaderStyle HorizontalAlign="Center" />
          <HeaderTemplate>投票答案名称</HeaderTemplate>
          <FooterStyle HorizontalAlign="Center" />
          <FooterTemplate>投票答案名称</FooterTemplate>
          <ItemStyle HorizontalAlign="center" />
          <ItemTemplate>
          <a href='admin_question_modify.aspx?id=<%#DataBinder.Eval(Container.DataItem,"Id")%>&tid=<%#DataBinder.Eval(Container.DataItem,"tid")%>'><%#DataBinder.Eval(Container.DataItem,"question") %></a>
          </ItemTemplate>
          </asp:TemplateColumn>
          
          <asp:TemplateColumn FooterStyle-CssClass="DataGrid1_Header_Footer" HeaderStyle-CssClass="DataGrid1_Header_Footer">
          <HeaderStyle Width="20%" HorizontalAlign="Center" />
          <HeaderTemplate>所属主题名称</HeaderTemplate>
          <FooterStyle Width="20%" HorizontalAlign="Center" />
          <FooterTemplate>所属主题名称</FooterTemplate>
          <ItemStyle Width="20%" HorizontalAlign="Center" />
          <ItemTemplate><%#GetSubject(Eval("Id").ToString())%></ItemTemplate>
          </asp:TemplateColumn>
          
          <asp:TemplateColumn FooterStyle-CssClass="DataGrid1_Header_Footer" HeaderStyle-CssClass="DataGrid1_Header_Footer">
          <HeaderStyle Width="20%" HorizontalAlign="Center" />
          <HeaderTemplate>所属问题</HeaderTemplate>
          <FooterStyle Width="20%" HorizontalAlign="Center" />
          <FooterTemplate>所属问题</FooterTemplate>
          <ItemStyle Width="20%" HorizontalAlign="Center" />
          <ItemTemplate><%#GetTitle(Eval("Id").ToString())%></ItemTemplate>
          </asp:TemplateColumn>
          
          <asp:TemplateColumn FooterStyle-CssClass="DataGrid1_Header_Footer" HeaderStyle-CssClass="DataGrid1_Header_Footer">
          <HeaderStyle Width="20%" HorizontalAlign="Center" />
          <HeaderTemplate>投票数</HeaderTemplate>
          <FooterStyle Width="20%" HorizontalAlign="Center" />
          <FooterTemplate>投票数</FooterTemplate>
          <ItemStyle Width="20%" HorizontalAlign="Center" />
          <ItemTemplate><%#DataBinder.Eval(Container.DataItem,"ps") %></ItemTemplate>
          </asp:TemplateColumn>
          
          <asp:TemplateColumn FooterStyle-CssClass="DataGrid1_Header_Footer" HeaderStyle-CssClass="DataGrid1_Header_Footer">
          <HeaderStyle Width="10%" HorizontalAlign="Center" />
          <HeaderTemplate>单项操作</HeaderTemplate>
          <FooterStyle Width="10%" HorizontalAlign="Center" />
          <FooterTemplate>单项操作</FooterTemplate>
          <ItemStyle Width="10%" HorizontalAlign="Center" />
          <ItemTemplate>
          <a href='admin_question.aspx?id=<%#DataBinder.Eval(Container.DataItem,"Id")%>&act=del'>删除</a>
          </ItemTemplate>
          </asp:TemplateColumn>
          </Columns>
      </asp:DataGrid>      
    </td>
  </tr>
  <tr>
  <td>
  <asp:Button ID="del" runat="server" Text="删除所选问题" CssClass="btn" 
          onclick="del_Click" />&nbsp;<input type="text" name="k" id="k" />&nbsp;<asp:Button 
          ID="search" Text="搜索问题" runat="server" CssClass="btn" onclick="search_Click" /></tr>
  </td>
  <tr>
  <td>
  共&nbsp;<asp:Label ID="recordlbl" runat="server" Text=""></asp:Label>&nbsp;条记录&nbsp;共&nbsp;<asp:Label ID="pageslbl" runat="server" Text=""></asp:Label>&nbsp;页&nbsp;第&nbsp;<asp:Label ID="pagelbl" runat="server" Text=""></asp:Label>&nbsp;页
  &nbsp;<asp:LinkButton ID="first" CommandArgument="FIRST" runat="server" Text="首页" 
          onclick="first_Click"></asp:LinkButton>&nbsp;
  <asp:LinkButton ID="prev" CommandArgument="PREV" runat="server" Text="上一页" 
          onclick="first_Click"></asp:LinkButton>&nbsp;
  <asp:LinkButton ID="next" CommandArgument="NEXT" runat="server" Text="下一页" 
          onclick="first_Click"></asp:LinkButton>&nbsp;
  <asp:LinkButton ID="last" CommandArgument="LAST" runat="server" Text="末页" 
          onclick="first_Click"></asp:LinkButton>
  </td>
  </tr>
  </form>
</table>
</body>
</html>
